package com.globallogic.javatrainings.sergiiivanov.tests;

import com.globallogic.javatrainings.sergiiivanov.model.Const;
import com.globallogic.javatrainings.sergiiivanov.model.Course;
import com.globallogic.javatrainings.sergiiivanov.model.University;
import com.globallogic.javatrainings.sergiiivanov.model.Const.Discipline;
import com.globallogic.javatrainings.sergiiivanov.model.Lecture.LectureType;
import com.globallogic.javatrainings.sergiiivanov.model.UniversityWarning;

public class BasicTest {
    protected University u;
    protected final String nPerson1="Name Person 1", 
            nPerson2 = "Name Person 2", 
            nPerson3 = "Name Person 3", 
            empty=Const.STRING_EMPTY,
            nUniversity = "Test University",
            nCourse1 = "Name Course 1",
            nCourse2 = "Name Course 2",
            nLec1 = "Name Lecture 1",
            nLec2 = "Name Lecture 2",
            nBuilding1 = "Name Building 1",
            nRoom1 = "Name Room 1",
            bname = "Test Building1",
            bname2 = "Test Building2",
            email = "no@mail.testing",
            mobile = "000 111 000",
            name = "Test Person",
            rname = "Test Room",
            rname2 = "Test Room 2",
            description1 = "Lorus ipsum...",
            description2 = "Test Description";
    protected final Discipline discipline1 = Discipline.Cpp, discipline2= Discipline.Java6;
    protected final LectureType lectureType1 = LectureType.LECTURE, lectureType2 = LectureType.PRACTICE;
    protected final String[] resumeEntryDetails = {"2013", "GL Java Courses", "Longest line maker"};
    
    /**
     * <pre>
     * makes university
     * 1 building
     *   1 room
     * 3 courses
     *   2 lectures each
     * 3 students
     * 3 teachers
     * 3 personnel 
     * </pre>
     */
    public University getUniversityDummy() throws Exception {
        University dummy = new University(nUniversity);
        dummy.buildings.addBuilding(nBuilding1);
        dummy.buildings.getBuildingByIndex(0).addRoom(nRoom1);
        dummy.courses.addCource(nCourse1, discipline1 );
        dummy.courses.addCource(nCourse2, discipline2);
        for(Course c: dummy.courses.getCourses()){
            c.addLecture(nLec1, lectureType1 , empty);
            c.addLecture(nLec2, lectureType2, empty);
        }
        dummy.personnel.addPersonnel(nPerson1, empty, empty);
        dummy.personnel.addPersonnel(nPerson2, empty, empty);
        dummy.personnel.addPersonnel(nPerson3, empty, empty);
        dummy.students.addPerson(nPerson1, empty, empty);
        dummy.students.addPerson(nPerson2, empty, empty);
        dummy.students.addPerson(nPerson3, empty, empty);
        dummy.teachers.addPerson(nPerson1, empty, empty);
        dummy.teachers.addPerson(nPerson2, empty, empty);
        dummy.teachers.addPerson(nPerson3, empty, empty);
        return dummy;
    }
    
    public BasicTest() {
        try {
            u = new University(nUniversity);
        } catch (UniversityWarning e) {
        }
    }
}
